﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BLL;

namespace MvcApplication1.Controllers
{
    public class SapController : Controller
    {
        public ActionResult LeadUpdated(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                var lead = SapConnection.Con.GetLead(id);
                var post = Posts.Get().Where(Posts.Columns.SapID, Actions.Equal, id).SelectOne();
                if (post != null)
                    post.Reply(lead.description);
            }
            return Json(true, JsonRequestBehavior.AllowGet);
        }

    }
}
